package xukj.proxy;

import xukj.network.SocketUtils;
import xukj.network.Trans;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @ClassName GetBean
 * @Description
 * @Author xukj
 * @Date 2019/1/11 9:22
 * @Version
 */
public class MyHandler implements InvocationHandler {

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) {

        //初始化
        Trans trans = new Trans();
        trans.setMethod(method.getName());
        method.getParameterTypes();
        trans.setParams(args);
        trans.setParamTypes(method.getParameterTypes());
        trans.setClazz(method.getDeclaringClass().getName());
        return SocketUtils.send(trans);

    }
}
